<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>康贝儿童医院预约管理系统</title>
<link href="/Public/css/bootstrap.min.css" rel="stylesheet">
<link href="/Public/css/metisMenu.css" rel="stylesheet">
<link href="/Public/css/sb-admin.css" rel="stylesheet">
<link href="/Public/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="/Public/js/datepicker/css/jquery.ui.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]>
<script src="/Public/js/html5shiv.js"></script>
<script src="/Public/js/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
var bzxuanzhe_ajax="<?php echo U('Index/kssection_ajax');?>";
var yzphone_ajax="<?php echo U('Index/yzphone_ajax');?>";
var yyadd="<?php echo U('Index/add_ajax');?>";
var right="<?php echo U('Index/right');?>";
var calls="<?php echo U('Index/calls');?>";
</script>
</head>
<body>
<div id="wrapper"> <nav class="navbar navbar-default navbar-fixed-top" role="navigation" style="margin-bottom: 0">
  <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
    <a class="navbar-brand" href="<?php echo U('Index/index');?>"><img src="/Public/images/logo.png"/></a> </div>
  <ul class="nav navbar-top-links navbar-right">
    <li> <a><i class="fa fa-user-circle-o"></i> <?php echo (session('juese')); ?></a></li>
    <li> <a><i class="fa fa-user"></i> <?php echo (session('username')); ?></a></li>
    <li> <a href="<?php echo U('Base/userex');?>"><i class="fa fa-user"></i> 修改密码</a></li>
    <li> <a href="<?php echo U('Base/logout');?>"><i class="fa fa-fw fa-power-off"></i> 退出登录</a> </li>
  </ul>
</nav>
<div class="sidebar left-sidebar" role="navigation">
  <div class="sidebar-nav navbar-collapse">
    <ul class="nav" id="side-menu">
      <?php if(is_array($menu)): $i = 0; $__LIST__ = $menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li> <a><i class="fa <?php echo ($vo["icon"]); ?> fa-fw"></i> <?php echo ($vo["qx_name"]); ?><span class="fa arrow"></span></a>
          <ul class="nav nav-second-level collapse">
            <?php if(is_array($vo['children'])): $i = 0; $__LIST__ = $vo['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><li <?php if(($v["state"]) == "0"): ?>style="display:none;"<?php endif; ?>><a href="<?php echo U("$v[url]");?>"><?php echo ($v["qx_name_1"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
          </ul>
        </li><?php endforeach; endif; else: echo "" ;endif; ?>
    </ul>
  </div>
</div>

<script src="/Public/js/jquery.js"></script> 
<link rel="stylesheet" type="text/css" href="/Public/js/layer/iCheck/flat/green.css" />
<script type="text/javascript" src="/Public/js/layer/iCheck/icheck.min.js"></script>
<link rel="stylesheet" type="text/css" href="/Public/js/layer/layer.css" />
<script src="/Public/js/bootstrap.min.js"></script> 
<script src="/Public/js/metisMenu.js"></script> 
<script src="/Public/js/sb-admin-2.js"></script> 
<script src="/Public/js/delall.js"></script> 
<script src="/Public/js/layer/bootbox.js"></script> 
<script src="/Public/js/layer/jquery-form.js"></script> 
<script src="/Public/js/layer/common.js"></script> 

  <div id="page-wrapper">   <nav class="navbreadcrumb"><i class="fa fa-dashboard"></i> <a href="<?php echo U('Index/index');?>">首页</a> > <?php echo ($main_menu); ?> > <?php echo ($son_menu); ?><a class="flush_btn hidden-xs" href="javascript:location.replace(location.href);" title="刷新"><i class="fa  fa-repeat"></i> 刷新</a><a class="flush_btn hidden-xs" href="<?php echo U('Index/index');?>" title="返回首页"><i class="fa  fa-home"></i> 返回首页</a></nav>
    <div class="container-fluid">
      <div class="row">
        <div class="col-md-12">
          <form  class="form-horizontal" role="form" id="AddkfForm">
            <div class="panel panel-default">
              <div class="panel-heading">客户基本信息</div>
            </div>
            <div class="form-group">
              <label class="col-md-2 control-label" for="username">姓名：</label>
              <div class="input-text col-md-2">
                <input type="text" name="username" class="form-control input-sm" id="username" placeholder="必填">
              </div>
              <label class="col-md-1 control-label" for="phone">电话：</label>
              <div class="input-text col-md-2">
                <input type="text"  name="phone" class="form-control input-sm" id="phone" placeholder="必填">
                <label id="sj_error" class='error' style="display:none;"></label>
              </div>
              <label class="col-md-1 control-label" for="sex">性别：</label>
              <div class="input-text col-md-2">
                <label class="checkbox-inline">
                  <input type="radio" name="sex" id="sex2" value="2" checked>
                  女 </label>
                <label class="checkbox-inline">
                  <input type="radio" name="sex" id="sex1"  value="1">
                  男 </label>
              </div>
            </div>
            <div class="form-group">
              <label class="col-md-2 control-label" for="age">年龄：</label>
              <div class="input-text col-md-2">
                <input type="text" name="age" class="form-control input-sm" id="age">
              </div>
              <label class="col-md-1 control-label" for="qq">QQ：</label>
              <div class="input-text col-md-2">
                <input type="text"  name="qq" class="form-control input-sm" id="qq">
              </div>
              <label class="col-md-1 control-label" for="isorder">预约：</label>
              <div class="input-text col-md-2">
                <select name="isorder" id="isorder" class="form-control input-sm">
                <?php if($m_id == 5 ): ?><option value="1">预约</option>
               <?php else: ?> 
                  <option value="1">预约</option>
                  <option value="0">登记</option><?php endif; ?> 
                </select>
              </div>
            </div>
            <div class="panel panel-default">
              <div class="panel-heading">预约挂号信息</div>
            </div>
            <div class="form-group">
              <label class="col-md-2 control-label" for="keshi">科室：</label>
              <div class="input-text col-md-2">
                <select name="keshi" id="keshi" class="form-control input-sm">
                  <option value="">--请选择--</option>
                  <?php if(is_array($keshilist)): $i = 0; $__LIST__ = $keshilist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($data["id"]); ?>"><?php echo ($data["section_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
              </div>
              <label class="col-md-3 control-label" for="time">预约时间：</label>
              <div class="input-text col-md-2">
                <input type="text" name="time" id="time" class="form-control input-sm" placeholder="必选">
              </div>
            </div>
            <div class="form-group">
              <label class="col-md-2 control-label" for="bingzhong">病种：</label>
              <div class="input-text col-md-2">
                <select name="bingzhong" id="bingzhong" class="form-control input-sm">
                </select>
              </div>
              <label class="col-md-3 control-label" for="area">地区：</label>
              <div class="input-text col-md-2">
                <select name="area" id="area" class="form-control input-sm">
                  <option value="">--请选择--</option>
                  <?php if(is_array($arealist)): $i = 0; $__LIST__ = $arealist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($data["id"]); ?>"><?php echo ($data["area_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
              </div>
            </div>
            <div class="form-group">
              <label class="col-md-2 control-label" for="bingzheng">病症：</label>
              <div class="input-text col-md-3">
                <textarea  name="bingzheng"  id="bingzheng" class="form-control input-sm" rows="6"></textarea>
              </div>
              <label class="col-md-2 control-label" for="remark">备注：</label>
              <div class="input-text col-md-3">
                <textarea name="remark"  id="remark" class="form-control input-sm" rows="6"></textarea>
              </div>
            </div>
            <div class="panel panel-default">
              <div class="panel-heading">营销渠道信息</div>
            </div>
            <div class="form-group">
              <label class="col-md-2 control-label" for="consult">咨询方式：</label>
              <div class="input-text col-md-2">
                <select name="consult" id="consult" class="form-control input-sm">
                  <?php if(is_array($consultlist)): $i = 0; $__LIST__ = $consultlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($data["id"]); ?>"><?php echo ($data["consult_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
              </div>
              <label class="col-md-3 control-label" for="type_in">录入者：</label>
              <div class="input-text col-md-2">
                 <?php if(($quanxian < 2)): ?><select name="type_in" id="type_in" class="form-control input-sm">
                        <option value="0">--请选择--</option>
                        <?php if(is_array($zxylist)): $i = 0; $__LIST__ = $zxylist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($data["name"]); ?>"><?php echo ($data["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                      </select>
                  <?php else: ?>
                      <input type="text" name="type_in" id="type_in" value="<?php echo (session('username')); ?>" class="form-control input-sm"><?php endif; ?>
                
              </div>


              <label class="col-md-1 control-label" for="info_channel" style="display:none;">信息渠道：</label>
              <div class="input-text col-md-2" style="display:none;">
                <select name="info_channel" id="info_channel" class="form-control input-sm">
                  <?php if(is_array($qudaoinfolist)): $i = 0; $__LIST__ = $qudaoinfolist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($data["id"]); ?>"><?php echo ($data["info_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
              </div>
            </div>
            <div class="form-group" style="display:none;">
              <label class="col-md-3 control-label" for="source_web">来源网站：</label>
              <div class="input-text col-md-2">
                <select name="source_web" id="source_web" class="form-control input-sm">
                  <?php if(is_array($weblist)): $i = 0; $__LIST__ = $weblist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($data["id"]); ?>"><?php echo ($data["web_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
              </div>
              <label class="col-md-3 control-label" for="source_url">来源网址：</label>
              <div class="input-text col-md-2">
                <input type="source_url" name="source_url" class="form-control input-sm" id="source_url">
              </div>
            </div>
            <div class="form-group" style="display:none;">
              <label class="col-md-1 control-label">永久身份：</label>
              <div class="input-text col-md-2">
                <input type="text" class="form-control input-sm" id="identitys" name="identitys">
              </div>
            </div>
            <div class="form-group" style="display:none;">
              <label class="col-md-3 control-label" for="marketing">营销方式：</label>
              <div class="input-text col-md-2">
                <select name="marketing" id="marketing" class="form-control input-sm">
                  <?php if(is_array($yingxiaolist)): $i = 0; $__LIST__ = $yingxiaolist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><option value="<?php echo ($data["id"]); ?>"><?php echo ($data["yingxiao_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
              </div>
              <label class="col-md-1 control-label" for="keyword">关键词：</label>
              <div class="input-text col-md-2">
                <input type="text" name="keyword" id="keyword" class="form-control input-sm">
              </div>
            </div>
            <div class="form-group pd-20">
              <div class="col-md-5  col-md-offset-5">
                <button type="submit" class="submitbtn btn btn-primary col-md-2  col-sm-12 col-xs-12">提交</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<script src="/Public/js/jquery.js"></script> 
<script src="/Public/js/bootstrap.min.js"></script> 
<script src="/Public/js/metisMenu.js"></script> 
<script src="/Public/js/sb-admin-2.js"></script> 
<script src="/Public/js/datepicker/js/jquery.datepicker.js"></script> 
<script src="/Public/js/validation/jquery.validate.min.js"></script> 
<script src="/Public/js/validation/messages_zh.js"></script> 
<script>
$(function(){
$( "#time" ).datepicker();      
$('#phone').blur(function() {
var phonenum = $(this).val();
if(phonenum){
$.ajax({      
type: 'POST',
url: yzphone_ajax,
data: {'phone':phonenum},
dataType: 'json',
beforeSend: function () {
$('#sj_error').empty();
        },
success: function(results) {
if(results.states==1){  
$('#sj_error').show();
$('#sj_error').append('电话号码有重复，请确定是否是夫妻号！');

}else{
$('#sj_error').hide();
$('#sj_error').empty();
  }


}
      });
}
});

  
  $("#AddkfForm").validate({
    rules:
    {
    username: "required",
    time:"required",
    keshi: "required",
    bingzhong:"required",
    area:"required",
    consult:"required",
    info_channel:"required",
    marketing:"required",
    
    },
    messages:
    {
      username: "姓名不能为空！",
    time: "时间不能为空！",
    keshi: "科室必须选择",
    bingzhong:"病种必须选择",
    area:"地区必须选择",
    consult:"咨询方式必须选择",
    info_channel:"信息渠道必须选择",
    marketing:"营销方式必须选择", 
     
    },
  submitHandler: function(form) {
        $.ajax({  
            url : yyadd,  
            type : "post",  
            dataType : "json",  
            data : $('#AddkfForm').serialize(),
            beforeSend: function(){
            $('.submitbtn').attr('disabled','disabled');
            },
            success : function(data) {
            if(data.state==1){
            if(data.dumpurl=='dengji'){


            location.href=right;


              }

            if(data.dumpurl=='calls'){

            location.href=calls;
              }
              }else{

                alert('添加失败，请重试！');

                }
              }  
        }); 

    },  
         invalidHandler: function(form, validator) {
       return false;  
          }  
  });
      $("#keshi").change(function() {
      var keshi_val = $("#keshi").val();
      $.ajax({
        type: 'POST',
        url: bzxuanzhe_ajax,
        data: {
          'keshi_val': keshi_val
        },
        dataType: 'json',
        success: function(json) {
          $("#bingzhong").empty();
          var list = json.list;
        var option = "";
          $.each(list,
          function(index, array) {
            option += "<option value='" + array['id'] + "'>" + array['bingzhong_name'] + "</option>"
          });
          $("#bingzhong").append(option)
        }
      })
    });

});
</script>
</body>
</html>